home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / comps / goodies / delphi10 / prntrdlg / prntrdlg.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-18  |  1.8 KB  |  71 lines

  1. unit Prntrdlg;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, CCPRNMGR;
  8.  
  9. type
  10.   TPrinterManagerDialog = class(TComponent)
  11.   private
  12.     { Private declarations }
  13.     TheForm       : TCCPrintForm;
  14.     FOnCreate     : TNotifyEvent;
  15.     FOnDestroy    : TNotifyEvent;
  16.     FOnShow       : TNotifyEvent;
  17.     FTop          : Integer;
  18.     FLeft         : Integer;
  19.   protected
  20.     { Protected declarations }
  21.   public
  22.     { Public declarations }
  23.     constructor Create( AOwner : TComponent ); override;
  24.     destructor Destroy; override;
  25.     procedure Show;
  26.   published
  27.     { Published declarations }
  28.     property Top : Integer read FTop write FTop;
  29.     property Left : Integer read FLeft write FLeft;
  30.     property OnCreate : TNotifyEvent read FOnCreate write FOnCreate;
  31.     property OnDestroy : TNotifyEvent read FOnDestroy write FOnDestroy;
  32.     property OnShow : TNotifyEvent read FOnShow write FOnShow;
  33.   end;
  34.  
  35. procedure Register;
  36.  
  37. implementation
  38.  
  39. constructor TPrinterManagerDialog.Create( AOwner : TComponent );
  40. begin
  41.   inherited Create( AOwner );
  42.   TheForm := TCCPrintForm.Create( Application.MainForm );
  43.   TheForm.Visible := false;
  44.   Application.HelpFile := 'PRNTDLG.HLP';
  45.   if Assigned( FOnCreate ) then OnCreate( Self );
  46. end;
  47.  
  48. destructor  TPrinterManagerDialog.Destroy;
  49. begin
  50.   if Assigned( FOnDestroy ) then OnDestroy( Self );
  51.   if Assigned( TheForm ) then TheForm.Close;
  52.   inherited Destroy;
  53. end;
  54.  
  55. procedure TPrinterManagerDialog.Show;
  56. begin
  57.   if Assigned( FOnShow ) then OnShow( Self );
  58.   TheForm.Position := poDesigned;
  59.   TheForm.Top := Top;
  60.   TheForm.Left := Left;
  61.   TheForm.Visible := true;
  62.   TheForm.Show;
  63. end;
  64.  
  65. procedure Register;
  66. begin
  67.   RegisterComponents('Goodies', [TPrinterManagerDialog]);
  68. end;
  69.  
  70. end.
  71.